package src.main.java.org.thread;

import java.util.concurrent.Callable;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.FutureTask;
/*
* Thread线程常用方法
* */
public class ThreadTest3 {
    public static void main(String[] args) {
        MyThread thread1 = new MyThread("1号线程");
        thread1.setName("1号线程");//为线程取名字
        thread1.start();
        System.out.println(thread1.getName());//获取线程名字

        MyThread thread2 = new MyThread("2号线程");//为线程取名字
        thread2.start();

        Thread thread = Thread.currentThread(); //哪个线程执行，就得到哪个线程对象
        System.out.println(thread.getName()); //主线程名字

        for (int i = 0; i <=5 ; i++) {
            System.out.println("main线程输出："+i);
        }
    }
}
